package com.java.demo.demo;

/**
 * @auther zhangwj
 * @date 2020/9/22 2:37 下午
 */
public class Demo3 {

    public static void main(String[] args) {
        AddNumber addNumber = new AddNumber();

        for (int i = 0; i < 100; i++) {
            new Thread(addNumber).start();
        }
    }
}

class AddNumber implements Runnable {

    private Integer po = 200;

    @Override
    public void run() {
        po--;
        synchronized (po) {
            System.out.println(Thread.currentThread().getId() + "-----" + po);
        }
    }
}